// Copyright 2023 Srhino Co., Ltd. All rights reserved.

package log

import (
	"os"

	"go.uber.org/zap"
)

func (wl *wrappedLogger) Debug(args ...interface{}) {
	wl.sugaredLogger.Debug(args...)
}

func (wl *wrappedLogger) Info(args ...interface{}) {
	wl.sugaredLogger.Info(args...)
}

func (wl *wrappedLogger) Warn(args ...interface{}) {
	wl.sugaredLogger.Warn(args...)
}

func (wl *wrappedLogger) Error(args ...interface{}) {
	wl.sugaredLogger.Error(args...)
}

func (wl *wrappedLogger) Panic(args ...interface{}) {
	wl.sugaredLogger.Panic(args...)
}

func (wl *wrappedLogger) Fatal(args ...interface{}) {
	wl.sugaredLogger.Fatal(args...)
}

func (wl *wrappedLogger) Debugf(format string, args ...interface{}) {
	wl.sugaredLogger.Debugf(format, args...)
}

func (wl *wrappedLogger) Infof(format string, args ...interface{}) {
	wl.sugaredLogger.Infof(format, args...)
}

func (wl *wrappedLogger) Warnf(format string, args ...interface{}) {
	wl.sugaredLogger.Warnf(format, args...)
}

func (wl *wrappedLogger) Errorf(format string, args ...interface{}) {
	wl.sugaredLogger.Errorf(format, args...)
}

func (wl *wrappedLogger) Panicf(format string, args ...interface{}) {
	wl.sugaredLogger.Panicf(format, args...)
}

func (wl *wrappedLogger) Fatalf(format string, args ...interface{}) {
	wl.sugaredLogger.Fatalf(format, args...)
}

func (wl *wrappedLogger) Sync() error {
	err := wl.sugaredLogger.Sync()
	if err != os.ErrInvalid {
		err = nil
	}

	err = wl.zapLogger.Sync()
	if err != os.ErrInvalid {
		return err
	}
	return nil
}

func (wl *wrappedLogger) GetZapLogger() *zap.Logger {
	return wl.zapLogger
}

func (wl *wrappedLogger) GetSugaredLogger() *zap.SugaredLogger {
	return wl.sugaredLogger
}

func (wl *wrappedLogger) GetLogger() Logger {
	return wl
}
